package cn.dm.controller;

import cn.dm.pojo.DmImage;
import cn.dm.service.DmImageService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
public class RestDmImageController {
    @Resource
    private DmImageService dmImageService;
    @PostMapping(value = "/getDmImageById")
    public DmImage getDmImageById(@RequestParam("id") Long id)throws Exception{
        return dmImageService.getDmImageById(id);
    }

    @PostMapping(value = "/getDmImageListByMap")
    public List<DmImage> getDmImageListByMap(@RequestBody Map<String, Object> param)throws Exception{
        return dmImageService.getDmImageListByMap(param);
    }

    @PostMapping(value = "/getDmImageCountByMap")
    public Integer getDmImageCountByMap(@RequestBody Map<String, Object> param)throws Exception{
        return dmImageService.getDmImageCountByMap(param);
    }

    @PostMapping(value = "/qdtxAddDmImage")
    public Integer qdtxAddDmImage(@RequestBody DmImage dmImage)throws Exception{
        return dmImageService.qdtxAddDmImage(dmImage);
    }

    @PostMapping(value = "/qdtxModifyDmImage")
    public Integer qdtxModifyDmImage(@RequestBody DmImage dmImage)throws Exception{
        return dmImageService.qdtxModifyDmImage(dmImage);
    }

    @PostMapping(value = "/queryDmImageList")
    public List<DmImage> queryDmImageList(@RequestParam("targetId") Long targetId,
                                          @RequestParam(value = "type", required = false) Integer type,
                                          @RequestParam(value = "category", required = false) Integer category) throws Exception{
        return dmImageService.queryDmImageList(targetId,type,category);
    }
}
